import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MaterialModelSupplierRelVO, MaterialModelSupplierRelForm, MaterialModelSupplierRelQuery } from '@/api/material/materialModelSupplierRel/types';

/**
 * 查询型号和供应商关联列表
 * @param query
 * @returns {*}
 */

export const listMaterialModelSupplierRel = (query?: MaterialModelSupplierRelQuery): AxiosPromise<MaterialModelSupplierRelVO[]> => {
  return request({
    url: '/material/materialModelSupplierRel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询型号和供应商关联详细
 * @param id
 */
export const getMaterialModelSupplierRel = (id: string | number): AxiosPromise<MaterialModelSupplierRelVO> => {
  return request({
    url: '/material/materialModelSupplierRel/' + id,
    method: 'get'
  });
};

/**
 * 新增型号和供应商关联
 * @param data
 */
export const addMaterialModelSupplierRel = (data: MaterialModelSupplierRelForm) => {
  return request({
    url: '/material/materialModelSupplierRel',
    method: 'post',
    data: data
  });
};

/**
 * 修改型号和供应商关联
 * @param data
 */
export const updateMaterialModelSupplierRel = (data: MaterialModelSupplierRelForm) => {
  return request({
    url: '/material/materialModelSupplierRel',
    method: 'put',
    data: data
  });
};

/**
 * 删除型号和供应商关联
 * @param id
 */
export const delMaterialModelSupplierRel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/material/materialModelSupplierRel/' + id,
    method: 'delete'
  });
};
